package com.windgo.service;

import com.windgo.bean.MarketDashboard;
import com.windgo.mapper.MarketDashMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 张林浩
 * @since 2022/10/12 09:11
 */
@Service
public class DashBoardServiceImpl implements DashBoardService {
    @Autowired
    MarketDashMapper marketDashMapper;

    @Override
    public MarketDashboard queryAllAmounts() {

        MarketDashboard marketDashboard =new MarketDashboard();
        //首页商品总数
        int goodsTotal = marketDashMapper.queryGoodsTotal();
        //首页订单总数
        int orderTotal = marketDashMapper.queryOrderTotal();
        //首页货物总数
        int productTotal = marketDashMapper.queryProductTotal();
        //首页用户总数
        int userTotal = marketDashMapper.queryUserTotal();
        //数据封装
        marketDashboard.setGoodsTotal(goodsTotal);
        marketDashboard.setOrderTotal(orderTotal);
        marketDashboard.setProductTotal(productTotal);
        marketDashboard.setUserTotal(userTotal);
        return marketDashboard;
    }
}
